Create arrayΒΆ
A[i]
Create an array of 5 integers and display the array items. Access individual element through indexes.
Arrays are sequence types and behave very much like lists,
except that the type of objects stored in them is constrained.
from array import *
AI = array('i', [1,3,5,7,9])
for i in AI:
print(i, end = "; ") # 1; 3; 5; 7; 9;
print("\nAccess first three items individually")
print(AI[0]) # 1
print(AI[1]) # 3
print(AI[2]) # 5
See also: https://www.w3resource.com/python-exercises/array/python-array-exercise-1.php